]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Avoid open state reentrancy in dummy menus
authorCarlos Garnacho <carlosg@gnome.org>
Sun, 13 Feb 2022 13:05:41 +0000 (14:05 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sun, 13 Feb 2022 13:25:42 +0000 (13:25 +0000)
Dummy menus may emit ::open-state-changed multiple times for
the same state. Avoid doing that so that the PopupMenuManager
is happy not having to handle reentrancy.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5064
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2178>

js/ui/popupMenu.js

index f30c0114680982155f581540e36954ad1e15ea47..5908f7a2950e8b10257960725ea6bf3a0a1fce08 100644 (file)
@@ -994,10 +994,16 @@ var PopupDummyMenu = class {
     }
 
     open() {
+        if (this.isOpen)
+            return;
+        this.isOpen = true;
         this.emit('open-state-changed', true);
     }
 
     close() {
+        if (!this.isOpen)
+            return;
+        this.isOpen = false;
         this.emit('open-state-changed', false);
     }